/*    */ package sl.com.sl.data;
/*    */ 
/*    */ import java.awt.Color;
/*    */ import javax.swing.JEditorPane;
/*    */ import javax.swing.text.DefaultHighlighter.DefaultHighlightPainter;
import javax.swing.text.DefaultHighlighter;
/*    */ import javax.swing.text.Highlighter;
import javax.swing.text.Highlighter.Highlight;
/*    */ 
/*    */ public class CSExchangeImpl
/*    */   implements CSExchange
/*    */ {
/*  9 */   public static final Color DEFAULT_COLOR = Color.blue;
/*    */   JEditorPane edit;
/*    */ 
/*    */   public CSExchangeImpl(JEditorPane edit)
/*    */   {
/* 14 */     this.edit = edit;
/*    */   }
/*    */   public JEditorPane getEditor() {
/* 17 */     return this.edit;
/*    */   }
/*    */   public HighlightInfo[] getHighlights() {
/* 20 */     HighlightInfo[] res = new HighlightInfo[this.edit.getHighlighter().getHighlights().length];
/*    */ 
/* 22 */     for (int i = 0; i < res.length; i++) {
/* 23 */       Color c = DEFAULT_COLOR;
/* 24 */       Highlighter.Highlight h = this.edit.getHighlighter().getHighlights()[i];
/* 25 */       if ((h.getPainter() instanceof DefaultHighlighter.DefaultHighlightPainter)) {
/* 26 */         DefaultHighlighter.DefaultHighlightPainter p = (DefaultHighlighter.DefaultHighlightPainter)h.getPainter();
/* 27 */         c = p.getColor();
/*    */       }
/* 29 */       res[i] = new HighlightInfoImpl(h.getStartOffset(), h.getEndOffset(), c);
/*    */     }
/*    */ 
/* 32 */     return res;
/*    */   }
/*    */ }

/* Location:           /home/julian/Documents/Demo/
 * Qualified Name:     com.sl.data.CSExchangeImpl
 * JD-Core Version:    0.6.0
 */